package com.damai.aop.impl;

import com.citywithincity.db.Db;
import com.citywithincity.db.Transaction;
import com.damai.aop.MethodInterceptor;
import com.damai.aop.MethodInvoker;

/**
 * 事务
 * @author renxueliang
 *
 */
public class TransInterceptor implements MethodInterceptor {
	
	//
	
	public static final String NONE = "NONE";
	
	public TransInterceptor() {
	//	Connection.TRANSACTION_NONE;
		
	}
	/*
	public TransInterceptor(String level){
		
		
	}
	*/

	@Override
	public void intercept(MethodInvoker invoker) {
		Db.trans(new Transaction<MethodInvoker, MethodInvoker>() {

			@Override
			public MethodInvoker execute(MethodInvoker p) {
				p.invoke();
				return p;
			}
		}, invoker);
		
		
	}

	

}
